*** Settings ***
Resource          ../../../../../CommonVars/Locations/SITSYS/MoudleView/LRiskView/LBSRiskView/LBsRiskbs0312View.robot
Library           Selenium2Library
Resource          ../../../../../CommonVars/Locations/SITSYS/MoudleView/LMotorView/LYancheView.robot
Library           ../../../../../CommonLibs/FDataFactors/DFactors.py
Resource          ../../../OpYanchePart.robot
Resource          ../../../../OpElements/OpElements.robot
Resource          ../../../../../CommonVars/Locations/SITSYS/MoudleView/LRiskView/LBSRiskView/LBsRisk0317View.robot
Resource          ../../../../../CommonVars/Locations/SITSYS/MoudleView/LRiskView/LBSRiskView/LBsCommonRiskView.robot

*** Keywords ***
Op Bs Risk Only 030101
    [Documentation]    只投保车损险 030101
    Scroll Element In View    ${LBsKindCode030101Check}
    sleep    1
    click element    ${LBsKindCode030101Check}

Op Bs Risk Only 030102
    [Documentation]    只投保车损险 030101
    Scroll Element In View    ${LBskindCode030102Check}
    sleep    1
    click element    ${LBskindCode030102Check}

Op Bs Risk Only 030102_保额
    [Arguments]    ${Memory}    # 保额
    [Documentation]    只投保车损险 030101
    Scroll Element In View    ${L第三者责任保险保额}
    #保额
    Select From List By Value    ${L第三者责任保险保额}    ${Memory}

Op Bs Risk Only 030102_保额_新能源
    [Arguments]    ${Memory}    # 保额
    [Documentation]    只投保车损险 030101
    Scroll Element In View    ${L新能源汽车第三者责任保险保额}
    #保额
    Select From List By Value    ${L新能源汽车第三者责任保险保额}    ${Memory}

Op Bs Risk Only 030104
    [Documentation]    只投保车损险 030101
    Scroll Element In View    ${LBskindCode030104Check}
    click element    ${LBskindCode030104Check}
    ${memory}=    Evaluate    random.randint(100, 99999)
    Input Text    ${LBsKindCode030104Meney}    ${memory}

Op Bs Risk Only 030104_030105
    [Documentation]    只投保车损险 030101
    Op Bs Risk Only 030104
    click element    ${LBsKindCode030105Check}
    ${memory}=    Evaluate    random.randint(100, 99999)
    Input Text    ${LBsKindCode030105Meney}    ${memory}

Op Bs Risk Only 主险
    OP Bs Risk Only 030101
    OP Bs Risk Only 030102
    OP Bs Risk Only 030104_030105

On Bs Check Flag
    Scroll Element In View    ${LCommercialInsuranceRiskCkeck}
    click element    ${LCommercialInsuranceRiskCkeck}

On Bs Check Flag 0317
    Scroll Element In View    ${LCommercialInsuranceRiskCkeck0317}
    click element    ${LCommercialInsuranceRiskCkeck0317}

On Bs Check Flag 附加外部电网故障损失险
    Scroll Element In View    ${L附加外部电网故障损失险check}
    click element    ${L附加外部电网故障损失险check}

On Bs Check Flag 充电桩损失和责任
    Scroll Element In View    ${L附加自用充电桩损失保险check}
    click element    ${L附加自用充电桩损失保险check}
    click element    ${L附加自用充电桩责任保险check}
    click element    ${L充电桩清单button}
    click element    ${L充电桩清单-添加}
    ${pileModel}=    Evaluate    random.randint(1000, 999999)
    input text    ${L充电桩型号}    ${pileModel}
    ${modelcode}=    ChargePileModelCode
    input text    ${L充电桩编码}    ${modelcode}
    # 随机
    ${index}=    Evaluate    random.randint(1, 3)
    Select from list by index    ${L充电桩种类}    ${index}
    Select from list by index    ${L安装地点}    ${index}
    ${installtime}=    ChargePileInstallltime
    input text    ${L安装时间}    ${installtime}
    ${addridex}=    Evaluate    random.randint(1, 30)
    Select from list by index    ${L省}    ${addridex}
    Select from list by index    ${L市}    1
    Select from list by index    ${L县}    1
    click element    ${L确定}

On Bs Check Flag 附加智能辅助软件损失补偿险
    Scroll Element In View    ${L附加智能辅助软件损失补偿险check}
    click element    ${L附加智能辅助软件损失补偿险check}

On Bs Check Flag 附加火灾事故限额翻倍险
    Scroll Element In View    ${L附加火灾事故限额翻倍险check}
    click element    ${L附加火灾事故限额翻倍险check}

Op Bs Risk 新能源主险+附加险
    Op Bs Risk Only 主险
    Op Bs Risk Only 新增设备
    On Bs Check Flag 附加车身划痕损失险
    On Bs Check Flag 附加修理期间费用补偿险
    On Bs Check Flag 附加精神损害抚慰金责任险-三者
    On Bs Check Flag 附加精神损害抚慰金责任险-司机
    On Bs Check Flag 附加精神损害抚慰金责任险-乘客
    On Bs Check Flag 附加外部电网故障损失险
    #On Bs Check Flag 充电桩损失和责任
    On Bs Check Flag 附加火灾事故限额翻倍险

Op Bs Risk 示范条款主险+附加险
    Op Bs Risk Only 主险
    Op Bs Risk Only 新增设备
    On Bs Check Flag 附加车身划痕损失险
    On Bs Check Flag 附加修理期间费用补偿险

Op Bs Risk Only 新增设备
    [Documentation]    只投保车损险 030101
    Scroll Element In View    ${LBsKindCode030109Check}
    click element    ${LBsKindCode030109Check}
    click element    ${LBsKindCode030109DeviceList}
    # 增加设备清单
    click element    ${LBsKindCode030109DeviceListAdd}
    ${modelcode}=    ChargePileModelCode
    input text    ${L设备名称}    ${modelcode}
    ${index}=    Evaluate    random.randint(1, 13)
    input text    ${L数量}    ${index}
    ${memory}=    Evaluate    random.randint(1000, 200000)
    ${point}=    Evaluate    random.randint(10, 99)
    ${price}=    set variable    ${memory}.${point}
    input text    ${L购置价格}    ${price}
    ${yyyy}    ${mm}    ${dd} =    Get Time    year,month,day
    ${now}=    set variable    ${yyyy}-${mm}-${dd}
    input text    ${L购置日期}    ${now}
    click element    ${L新增设备清单确定}

On Bs Check Flag 附加车身划痕损失险
    Scroll Element In View    ${LBsKindCode030110Check}
    click element    ${LBsKindCode030110Check}

On Bs Check Flag 附加修理期间费用补偿险
    Scroll Element In View    ${LBsKindCode030112Check}
    click element    ${LBsKindCode030112Check}
    #生成小数
    ${memory}=    Evaluate    random.randint(1000, 200000)
    ${point}=    Evaluate    random.randint(10, 99)
    ${memorypoint}=    set variable    ${memory}.${point}
    input text    ${LBsKindCode030112Meney}    ${memorypoint}
    ${days}=    Evaluate    random.randint(1, 20)
    input text    ${LBsKindCode030112Days}    ${days}

On Bs Check Flag 附加精神损害抚慰金责任险-三者
    Scroll Element In View    ${L附加精神损害抚慰金责任险-三者}
    click element    ${L附加精神损害抚慰金责任险-三者}
    ${memory}=    Evaluate    random.randint(1000, 20000)
    ${point}=    Evaluate    random.randint(10, 99)
    ${memorypoint}=    set variable    ${memory}.${point}
    input text    ${L附加精神损害抚慰金责任险-三者Mem}    ${memorypoint}

On Bs Check Flag 附加精神损害抚慰金责任险-司机
    Scroll Element In View    ${L附加精神损害抚慰金责任险-司机}
    click element    ${L附加精神损害抚慰金责任险-司机}
    ${memory}=    Evaluate    random.randint(1000, 20000)
    ${point}=    Evaluate    random.randint(10, 99)
    ${memorypoint}=    set variable    ${memory}.${point}
    input text    ${L附加精神损害抚慰金责任险-司机Mem}    ${memorypoint}

On Bs Check Flag 附加精神损害抚慰金责任险-乘客
    Scroll Element In View    ${L附加精神损害抚慰金责任险-乘客}
    click element    ${L附加精神损害抚慰金责任险-乘客}
    ${memory}=    Evaluate    random.randint(1000, 20000)
    ${point}=    Evaluate    random.randint(10, 99)
    ${memorypoint}=    set variable    ${memory}.${point}
    input text    ${L附加精神损害抚慰金责任险-乘客Mem}    ${memorypoint}
